var mongoose = require('mongoose');

var db = mongoose.connect('localhost:27017/char') //连接数据库

db.connection.on('open',function () {
	console.log('success')
})

var Schema = mongoose.Schema;

var userSchame = new Schema({
	userName:String,
	password:String
})

var user = db.model('users',userSchame);

user.find({},function (err,doc) {
	console.log(doc)
})

user.create({userName:"xupeng",password:'593936999'},function (err,doc) {
	console.log(doc)
})


// var user_id_2 = new user({
// 	userName:'humin',
// 	passowrd:'123456'
// })

// user_id_2.save(function (err,doc) {
// 	console.log(doc)
// })

// exports.user = db.model('users',userSchame)